<template>
  <div class="footer-container">
    <!-- 左侧的复选框 -->
    <div class="custom-control custom-checkbox">
      <input
        type="checkbox"
        :checked="isAllState"
        class="custom-control-input"
        id="fullcheck"
        @click="FooterisAll"
      />
      <label class="custom-control-label" for="fullcheck">全选</label>
    </div>

    <!-- 中间的合计 -->
    <div>
      <span>合计：</span>
      <span class="price">￥{{ isAllPrice }}</span>
    </div>

    <!-- 右侧结算按钮 -->
    <button class="btn btn-primary btn-settle">
      结算（ {{ isAllCount }} ）
    </button>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  name: 'MyFooter',
  computed: {
    // 全选状态 总价  结算总个数
    ...mapGetters('Day7Shoppin', ['isAllState', 'isAllPrice', 'isAllCount'])
  },
  methods: {
    // 全选影响 小选
    FooterisAll(e) {
      this.$store.commit('Day7Shoppin/updateIsAllState', e.target.checked)
    }
  }
}
</script>

<style lang="less" scoped>
.footer-container {
  background-color: white;
  height: 50px;
  border-top: 1px solid #f8f8f8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  position: fixed;
  bottom: 25px;
  left: 0;
  width: 100%;
  z-index: 999;
}

.price {
  color: red;
  font-size: 13px;
  font-weight: bold;
}

.btn-settle {
  height: 40px;
  min-width: 100px;
  border-radius: 20px;
}
</style>
